package org.xxforest.game.core.scenes.scene2d.events.type;

import org.xxforest.game.core.scenes.scene2d.XXNode;
import org.xxforest.game.core.scenes.scene2d.events.XXEvent;
import org.xxforest.game.core.scenes.scene2d.events.XXEventType;

public class XXKeyPressEvent implements XXEvent{

	private int [] pressKeys ;
	private XXNode target ;
	
	public XXKeyPressEvent(XXNode target , int[] pressKeys){
		this.target = target ;
		this.pressKeys = pressKeys ;
	}
	
	public static XXKeyPressEvent create(XXNode target ,int[] pressKeys){
		return new XXKeyPressEvent(target ,pressKeys) ;
	}
	
	public boolean isPress(int keyCode){
		for(int kg : pressKeys){
			if(kg == keyCode){
				return true ;
			}
		}
		return false ;
	}
	
	public XXNode getTarget() {
		return target;
	}

	@Override
	public void dispose() {
		
	}

	@Override
	public XXEventType getEventType() {
		return XXEventType.KEYPRESS;
	}

}
